<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-calendar"></i> 用户管理
                </el-breadcrumb-item>
                <el-breadcrumb-item>添加用户</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" :model="form" label-width="80px">
                    <el-form-item label="用户名" prop="title">
                        <el-input v-model="form.title"></el-input>
                    </el-form-item>
                    <el-form-item label="电子邮件" prop="categories">
                        <el-input v-model="form.categories"></el-input>
                    </el-form-item>
                    <el-form-item label="头像地址" prop="tags">
                        <el-input v-model="form.tags"></el-input>
                    </el-form-item>

                    <el-form-item label="密码" prop="content">
                        <el-input v-model="form.tags"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">表单提交</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
    import { mavonEditor } from 'mavon-editor'
    import 'mavon-editor/dist/css/index.css'
    export default {
        name: 'AddUser',
        components:{mavonEditor},
        data() {
            return {
                form: {
                    title: '',
                    categories: '',
                    tags: '',
                    context: '',
                }
            };
        },
        methods: {
            onSubmit() {
                const _this=this
                this.$axios.post("http://39.106.115.234:8083/article/publish",this.form,{
                    headers:{
                        "Authorization":localStorage.getItem("token")
                    }
                }).then(res=>{
                    // console.log(res.data)
                    _this.$message.success(res.data.message)
                    _this.$router.push("/table")
                })
                // this.$message.success('提交成功！');
            }
        }
    };
</script>

